Skip to content

fix completions replacing punctuation#2618

Closed
xdBronch wants to merge 1 commit intozigtools:masterfrom
xdBronch:completion
Closed

fix completions replacing punctuation#2618
xdBronch wants to merge 1 commit intozigtools:masterfrom
xdBronch:completion

Conversation

@xdBronch
Copy link
Contributor

basically the same as #2605, the (,[,{ would get replaced when completions were manually triggered
this affected a lot more than what I added tests for but it seems unlikely that any one in particular would uniquely regress so I just did some more likely cases to keep it small

@Techatrix
Copy link
Member

This does not handle "replace" text edits correctly in certain cases:

const foo = 5;
const bar = foo(f<cursor>oo);

The "replace" text edit should change the line to the following:

const bar = foo(foo);

but instead it does the same as the "insert" text edit:

const bar = foo(foooo);

Test Case:

    try testCompletionTextEdit(.{
        .source =
        \\const foo = 5;
        \\const bar = foo(<cursor>foo);
        ,
        .label = "foo",
        .expected_insert_line = "const bar = foo(foofoo);",
        .expected_replace_line = "const bar = foo(foo);",
    });

Since I had some related fixes to completion text edits, I went ahead and fixed this in #2621.

@Techatrix Techatrix closed this Feb 21, 2026
@xdBronch xdBronch deleted the completion branch February 21, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants